#pragma once
#include <queue>
#include <vector>

#include "GraphSearch.h"

class AStarSearch
	: public GraphSearch
{
public:
	AStarSearch(void);
	~AStarSearch(void);

	node* search(Graph* g, Vector2 start, Vector2 goal, bool penalized);
	vector<Vector2> get_search_path(Graph* g, Vector2 start, Vector2 goal);

protected:
	void performSearch(node* start, node* goal, Grapher* gr=NULL, bool penalized=false, int maxExpandVectors=-1);
	void performSearchOptimized(node* start, node* goal, Grapher* gr, bool penalized);
	const char* getFileName();

private:
	float dist(Vector2 v1, Vector2 v2);
	vector <Vector2> RemoveRedundantWayPoints(vector <Vector2> path);
	node* getNearestNotOccupied(Graph* g, node* goalNode);

	std::priority_queue<queue_node, std::vector<queue_node>, CompareQueueNode> queue;
};

